{% extends "base.html" %}

{% block title %}编辑任务 - 任务流{% endblock %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-md-8 col-lg-7">
        <div class="card">
            <div class="card-header">
                <h1 class="h3 mb-0">编辑任务</h1>
            </div>
            <div class="card-body">
                <form method="POST">
                    <div class="mb-3">
                        <label for="title" class="form-label">标题</label>
                        <input type="text" class="form-control" id="title" name="title" value="{{ task.title }}" required>
                    </div>
                    <div class="mb-3">
                        <label for="description" class="form-label">描述</label>
                        <textarea class="form-control" id="description" name="description" rows="3">{{ task.description or '' }}</textarea>
                    </div>
                    <div class="row">
                        <div class="col-md-6 mb-3">
                            <label for="priority" class="form-label">优先级</label>
                            <select class="form-select" id="priority" name="priority">
                                <option value="low" {% if task.priority == 'low' %}selected{% endif %}>低</option>
                                <option value="medium" {% if task.priority == 'medium' %}selected{% endif %}>中</option>
                                <option value="high" {% if task.priority == 'high' %}selected{% endif %}>高</option>
                            </select>
                        </div>
                        <div class="col-md-6 mb-3">
                            <label for="status" class="form-label">状态</label>
                            <select class="form-select" id="status" name="status">
                                <option value="todo" {% if task.status == 'todo' %}selected{% endif %}>待办</option>
                                <option value="in_progress" {% if task.status == 'in_progress' %}selected{% endif %}>进行中</option>
                                <option value="completed" {% if task.status == 'completed' %}selected{% endif %}>已完成</option>
                            </select>
                        </div>
                    </div>
                    <div class="mb-3">
                        <label for="due_date" class="form-label">截止日期</label>
                        <input type="date" class="form-control" id="due_date" name="due_date" value="{{ task.due_date.strftime('%Y-%m-%d') if task.due_date }}">
                    </div>
                    <div class="d-flex justify-content-end gap-2 mt-4">
                        <a href="{{ url_for('main.index') }}" class="btn btn-secondary">取消</a>
                        <button type="submit" class="btn btn-primary">保存更改</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %}